package com.mm.bo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @author 林友航
 * @version 1.0
 * @date 2020/12/4 11:18
 */
@Data
@ApiModel(value = "部门管理查询员工Bo", description = "从客户端传入的数据封装实体")
public class DepartmentSearchBo {
    /**
     * 查询条件 : 工号、姓名
     */
    @ApiModelProperty(value = "search", name = "搜索条件(工号、姓名)", required = false)
    private String search;

    /**
     * 部门信息
     */
    @ApiModelProperty(value = "depaId", name = "部门信息", required = false)
    private String depaId;

    /**
     * 开始时间
     */
    @ApiModelProperty(value = "beginTime", name = "入职时间开始时间", required = false)
    private Long beginTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value = "endTime", name = "入职时间结束时间", required = false)
    private Long endTime;
    /**
     * 当前页
     */
    @NotNull(message = "当前页不能为空")
    @Min(value = 1, message = "当前页最小为1")
    private Integer pageIndex;

    /**
     * 每页数据
     */
    @NotNull(message = "没有数据不能为空")
    @Min(value = 1, message = "没有数据最小则为1")
    private Integer pageSize;

    public Integer getPageIndex() {
        if (pageIndex < 1) {
            pageIndex = 0;
            return pageIndex;
        } else {
            return (pageIndex - 1) * pageSize;
        }
    }


}
